#pragma once
#include "Object.h"
#include "Player.h"
#include "Monster.h"
#include <hash_map>
using namespace stdext;

typedef hash_map<int, Object*> ObjectMap;

class ObjectMgr
{
private:
	ObjectMgr()
	{
		m_stObjectMap.clear();
		m_iMaxID = 1;
	}

public:
	static ObjectMgr& GetInstance()
	{
		static ObjectMgr s_inst;
		return s_inst;
	}

	int TickAllObject();

	Player* CreatePlayer();
	Monster* CreateMonster();
	int DestroyObject(Object* pObject);
	Object* GetObjectByID(int iID);
	
private:
	void _AddToManager(Object* pObject);
	void _DelFromManager(Object* pObject);

private:
	int m_iMaxID;
	ObjectMap m_stObjectMap;
	int m_iLastTickTime;
};

#define OM ObjectMgr::GetInstance()